<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //javascript中的对象类型的key只能是String或Symbol，如果是对象则自动转换成[object Object]
        let jack={name:"jack"};
        let mark={name:"mark"};
        let objectMap={};
        objectMap[jack]=jack.name;  //将jack转换成字符串[object Object]，作为key
        objectMap[mark]=mark.name;  //将mark转换成字符串[object Object]，作为key
        console.log(objectMap[jack],objectMap[mark]);
        console.log(objectMap["[object Object]"]);
        console.log(objectMap);
    </script>
</body>
</html>